package com.classtest;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        //键盘录入
        Scanner sc = new Scanner(System.in);

        //调用对象
        Worker worker = new Worker();
        //输入姓名
        System.out.println("请录入工人姓名");
        worker.setName(sc.next());
        //输入年龄
        System.out.println("请录入工龄");
        worker.setYear(sc.nextInt());

        System.out.println("姓名为：" + worker.getName());
        System.out.println("工龄为：" + worker.getYear() + "年");
    }
}
